package com.starleague.battletech.unit.mech.jpa.appengine;

import java.util.Map;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import com.starleague.battletech.unit.jpa.appengine.BattletechUnitCriticalSlotGae;
import com.starleague.battletech.unit.mech.IMechCriticalSlot;
import com.starleague.battletech.unit.mech.MechHitLocationPosition;

@MappedSuperclass
public abstract class MechCriticalSlotGae
        extends BattletechUnitCriticalSlotGae
        implements IMechCriticalSlot
{
    @Basic(optional = false)
    @Column(nullable = false)
    private MechHitLocationPosition position;

    protected MechCriticalSlotGae(MechHitLocationPosition position,
                                  int index)
    {
        super(index);
        this.position = position;
    }

    protected MechCriticalSlotGae()
    {
        //
    }

    public MechHitLocationPosition getPosition()
    {
        return this.position;
    }

    protected void setPosition(MechHitLocationPosition position)
    {
        this.position = position;
    }

    // @Override
    // public MechHitLocationGae getHitLocation()
    // {
    // return ((MechGae) getComponent().getMech()).getHitLocation(this.position);
    // }

    @Override
    public Map<String, Object> infoProperties()
    {
        Map<String, Object> infoPropertyMap = super.infoProperties();
        infoPropertyMap.put("position", this.position);
        return infoPropertyMap;
    }

    public abstract String toStringSingleLine();
}
